﻿@functions{
    public MvcHtmlString GetSelectedMenuClass(SiteUserMenu currentMenu, SiteUserMenu selectedMenu)
    {
        if (currentMenu == selectedMenu)
            return MvcHtmlString.Create(" class=\"active\"");

        return MvcHtmlString.Empty;
    }
    public MvcHtmlString GetSelectedMenuClass(CompanyMenu currentMenu, CompanyMenu selectedMenu)
    {
        if (currentMenu == selectedMenu)
            return MvcHtmlString.Create(" class=\"active\"");

        return MvcHtmlString.Empty;
    }
    public MvcHtmlString GetSelectedMenuClass(AdminMenu currentMenu, AdminMenu selectedMenu)
    {
        if (currentMenu == selectedMenu)
            return MvcHtmlString.Create(" class=\"active\"");

        return MvcHtmlString.Empty;
    }
}

@if (SessionCache.CurrentUser != null)
{
    <ul class="nav nav-pills nav-stacked">
        @if (UserInfo.IsCompanyUser)
        {
            CompanyMenu selectedMenu = CompanyMenu.None;
            if (ViewData[AppConstants.ViewDataKeys.SELECTED_MENU] != null)
            {
                selectedMenu = (CompanyMenu)ViewData[AppConstants.ViewDataKeys.SELECTED_MENU];
            }
            <li @GetSelectedMenuClass(CompanyMenu.Dashboard, selectedMenu)><a href="@Url.PrivateUrl("Dashboard", "Account")"><i class="glyphicon glyphicon-chevron-right pull-right"></i> Dashboard</a></li>
            <li @GetSelectedMenuClass(CompanyMenu.Profile, selectedMenu)><a href="@Url.PrivateUrl("ProfileEdit", "Company")"><i class="glyphicon glyphicon-chevron-right pull-right"></i>@{if(SessionCache.CurrentUser.CompanyInfo.IsIncompleteProfile) { <span class="badge pull-right">i</span> }} Company Profile</a></li>
            <li @GetSelectedMenuClass(CompanyMenu.Contacts, selectedMenu)><a href="@Url.PrivateUrl("List", "Contact")"><i class="glyphicon glyphicon-chevron-right pull-right"></i><span class="badge pull-right" id="span_contact_count">@SessionCache.CurrentUser.CompanyInfo.ContactCount</span> Manage Contacts</a></li>
            <li @GetSelectedMenuClass(CompanyMenu.Projects, selectedMenu)><a href="@Url.PrivateUrl("List", "Product")"><i class="glyphicon glyphicon-chevron-right pull-right"></i><span class="badge pull-right" id="span_LM_Total_Job">@SessionCache.CurrentUser.CompanyInfo.ProjectCount</span> Manage Projects</a></li>
            <li @GetSelectedMenuClass(CompanyMenu.ProjectLeads, selectedMenu)><a href="@Url.PrivateUrl("List", "Lead")"><i class="glyphicon glyphicon-chevron-right pull-right"></i><span class="badge pull-right">@SessionCache.CurrentUser.CompanyInfo.UnreadLeadCount</span> Project Leads</a></li>
            <li @GetSelectedMenuClass(CompanyMenu.ChangePassword, selectedMenu)><a href="@Url.PrivateUrl("ChangePassword", "Account")"><i class="glyphicon glyphicon-chevron-right pull-right"></i> Change Password</a></li>
            

            
        }
        else if (UserInfo.IsAdmin)
        {
            AdminMenu selectedMenu = AdminMenu.None;
            if (ViewData[AppConstants.ViewDataKeys.SELECTED_MENU] != null)
            {
                selectedMenu = (AdminMenu)ViewData[AppConstants.ViewDataKeys.SELECTED_MENU];
            }
            @*<li>@Html.AdminLink("Manage Categories", "List", "Category")</li>
            <li>@Html.AdminLink("Manage Industry Types", "List", "IndustryType")</li>
            <li>@Html.AdminLink("Manage Contents", "List", "Content")</li>
            <li>@Html.AdminLink("Manage Search", "SearchIndexStatus", "SearchConfig")</li>
            <li>@Html.PrivateLink("My Favorites", "", "Favorites")</li>*@

            <li @GetSelectedMenuClass(AdminMenu.Dashboard, selectedMenu)><a href="@Url.PrivateUrl("Dashboard", "Account")"><i class="glyphicon glyphicon-chevron-right pull-right"></i> Dashboard</a></li>
            <li @GetSelectedMenuClass(AdminMenu.ManageCategory, selectedMenu)><a href="@Url.AdminUrl("List", "Category")"><i class="glyphicon glyphicon-chevron-right pull-right"></i> Manage Categories</a></li>
            <li @GetSelectedMenuClass(AdminMenu.ManageLookupData, selectedMenu)><a href="@Url.AdminUrl("List", "LookupData")"><i class="glyphicon glyphicon-chevron-right pull-right"></i> Manage Lookup Data</a></li>

            <li @GetSelectedMenuClass(AdminMenu.ManageContents, selectedMenu)><a href="@Url.AdminUrl("List", "Content")"><i class="glyphicon glyphicon-chevron-right pull-right"></i> Manage Contents</a></li>
            <li @GetSelectedMenuClass(AdminMenu.SearchConfig, selectedMenu)><a href="@Url.AdminUrl("Index", "SearchConfig")"><i class="glyphicon glyphicon-chevron-right pull-right"></i> Manage Search</a></li>
            <li @GetSelectedMenuClass(AdminMenu.BackupDatabase, selectedMenu)><a href="@Url.AdminUrl("BackupDB", "Utility")"><i class="glyphicon glyphicon-chevron-right pull-right"></i> Backup Database</a></li>
            @*<li @GetSelectedMenuClass(AdminMenu.ChangePassword, selectedMenu)><a href="@Url.AdminUrl("ChangePassword", "Account")"><i class="glyphicon glyphicon-chevron-right pull-right"></i> Change Password</a></li>
            <li @GetSelectedMenuClass(AdminMenu.ChangePassword, selectedMenu)><a href="@Url.AdminUrl("ChangePassword", "Account")"><i class="glyphicon glyphicon-chevron-right pull-right"></i> Change Password</a></li>
            <li @GetSelectedMenuClass(AdminMenu.ChangePassword, selectedMenu)><a href="@Url.AdminUrl("ChangePassword", "Account")"><i class="glyphicon glyphicon-chevron-right pull-right"></i> Change Password</a></li>*@
        }
        else if (UserInfo.IsSiteUser)
        {
            SiteUserMenu selectedMenu = SiteUserMenu.None;
            if (ViewData[AppConstants.ViewDataKeys.SELECTED_MENU] != null)
            {
                selectedMenu = (SiteUserMenu)ViewData[AppConstants.ViewDataKeys.SELECTED_MENU];
            }
            @*<li>@Html.PrivateLink("My Favorites", "", "Favorites")</li>*@
            <li @GetSelectedMenuClass(SiteUserMenu.Dashboard, selectedMenu)><a href="@Url.PrivateUrl("Dashboard", "Account")"><i class="glyphicon glyphicon-chevron-right pull-right"></i> Dashboard</a></li>
            <li @GetSelectedMenuClass(SiteUserMenu.Profile, selectedMenu)><a href="@Url.SiteUserUrl("Profile", "Account")"><i class="glyphicon glyphicon-chevron-right pull-right"></i> My Profile</a></li>
            <li @GetSelectedMenuClass(SiteUserMenu.Favorites, selectedMenu)><a href="@Url.SiteUserUrl("List", "Favorites")"><i class="glyphicon glyphicon-chevron-right pull-right"></i> Favorites</a></li>
            <li @GetSelectedMenuClass(SiteUserMenu.SavedSearch, selectedMenu)><a href="@Url.SiteUserUrl("List", "SavedSearch")"><i class="glyphicon glyphicon-chevron-right pull-right"></i> Saved Searchs</a></li>    
        }
    </ul>
}